import { ref, Ref } from 'vue'

export interface CakeRoom {
    stock: Ref<number>
    takeCake: () => boolean
}


export const useCakeRoom = ():CakeRoom => {
    const stock = ref(20)
    const takeCake = () => {
        if (stock.value === 0) {
            return false
        }
        stock.value -= 1
        return true;
    }

    return {
        stock,
        takeCake
    }
}

// export interface CakeRoom {
//     stock: Ref<string>
//     takeCake: () => boolean
// }